#!/bin/bash

source ./redis.env
echo '正在初始化环境'
home=$ALBERTMU_REDIS_WORKSPACE
if [[ -d $home ]]; then
    echo "初始化环境失败，文件夹【${home}】已存在。"
    exit 1
fi

mkdir $home && mkdir $home/conf && mkdir $home/data
cp ./redis.conf $home/conf/
echo '初始化成功'
echo '正在部署容器'

docker run -d --name $ALBERTMU_C_NAME \
 --privileged=true \
 --restart=always \
 --net $VNET_NAME \
 -p 6379:6379 \
 -v ${home}/conf:/usr/local/etc/redis \
 -v ${home}/data:/data \
 redis:${ALBERTMU_REDIS_VERSION} redis-server /usr/local/etc/redis/redis.conf
echo 'redis已部署完成！'
